package com.zq.structure.flyweight;

// 对应为flyweight
public abstract class Character {
    protected char letter;
    protected int fontSize;

    Character() {}

    public abstract void display();

    public abstract void setFontSize(int fontSize);
}

class CharacterA extends Character {

    CharacterA() {
        letter = 'A';
        fontSize = 12;
    }

    @Override
    public void display() {
        System.out.println(letter);
    }

    @Override
    public void setFontSize(int fontSize) {
        this.fontSize = fontSize;
    }
}

class CharacterB extends Character {

    CharacterB() {
        letter = 'B';
        fontSize = 12;
    }

    @Override
    public void display() {
        System.out.println(letter);
    }

    @Override
    public void setFontSize(int fontSize) {
        this.fontSize = fontSize;
    }
}